import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow.
// so only in production use lazy-loading;
Vue.use(Router)
// import index from '@/views/index/index'

// /**
// * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
// * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
// *                                if not set alwaysShow, only more than one route under the children
// *                                it will becomes nested mode, otherwise not show the root menu
// * redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
// * name:'router-name'             the name is used by <keep-alive> (must set!!!)
// * meta : {
//     title: 'title'               the name show in subMenu and breadcrumb (recommend set)
//     icon: 'svg-name'             the icon show in the sidebar
//     breadcrumb: false            if false, the item will hidden in breadcrumb(default is true)
//   }
// **/

export default new Router({
  routes: [

    {
      path: '/login',
      name: 'Login',
      component: () => import('@/views/login/index')
    },
    {
      path: '/homepage',
      name: 'homepage',
      redirect: '/index',
      component: () => import('@/views/homepage'),
      children: [
        // 首页
        {
          path: '/index',
          component: () => import('@/views/index'),
          meta: {
            name: '首页'
          }
        },
        // 基础信息管理
        {
          path: '/basic/menu',
          component: () => import('@/views/basic/menu'),
          meta: {
            name: '菜单信息管理'
          }
        },
        {
          path: '/basic/shop',
          component: () => import('@/views/basic/shop'),
          meta: {
            name: '经营户管理'
          }
        },
        {
          path: '/basic/stall',
          component: () => import('@/views/basic/stall'),
          meta: {
            name: '摊位管理'
          }
        },
        {
          path: '/basic/balance',
          component: () => import('@/views/basic/balance'),
          meta: {
            name: '秤在线时间'
          }
        },
        {
          path: '/basic/judge',
          component: () => import('@/views/basic/judge'),
          meta: {
            name: '秤标定管理'
          }
        },
        // //商品管理
        // {
        //   path: '/goods/index',
        //   component: () => import('')
        // },
        // {
        //   path: '/goods/replace',
        //   component: () => import('')
        // },
        // //交易信息
        {
          path: '/deal/index',
          component: () => import('@/views/deal/index'),
          meta: {
            name: '交易信息'
          }
        },
        // {
        //   path: '/deal/statistics',
        //   component: () => import('')
        // },
        // {
        //   path: '/deal/manage',
        //   component: () => import('')
        // },
        // {
        //   path: '/deal/report',
        //   component: () => import('')
        // },
        // //快检信息
        // {
        //   path: '/quickcheck/index',
        //   component: () => import('')
        // },
        // {
        //   path: '/quickcheck/monthreport',
        //   component: () => import('')
        // },
        {
          path: '/fabric/view',
          component: () => import('@/views/fabric/index'),
          meta: {
            name: '区块链数据总览'
          }
        }
      ]
    },

    {
      path: '/notFound',
      name: 'NotFound',
      component: resolve => require(['@/views/404.vue'], resolve)
    },
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '*',
      redirect: '/notFound'
    }
  ]
})
